package com.houger.ddd.seckill.constant;

import java.util.Arrays;

/**
 * @Description
 * @Author gantt
 * @Date 2021/1/21 17:00
 */
public enum PlatformEnum {
    ALL( 1, "全部可用"),
    OFFLINE_SHOP( 2, "线下门店"),
    ONLINE_SHOP( 3, "线上商城"),
    UNKNOW( 0, "未知");

    private int value;
    private String desc;

    PlatformEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static PlatformEnum getEnumByCode(int value) {
        return Arrays.stream(PlatformEnum.values()).filter(a -> a.value == value).findFirst().orElse(UNKNOW);
    }
}
